package com.pf.controller;

import com.pf.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author PF
 * @date 2021/6/24 20:41
 * @Version 1.0
 */
@RestController
@RequestMapping("/mail")
public class MailController {


    @Autowired
    private MailService mailService;

    /**
     * 发送文本邮件
     *
     * @return
     */
    @GetMapping("/sendTextMail")
    public String sendTextMail() {
        mailService.sendTextMail();
        return "success";
    }

    /**
     * 发送HTML内容邮件
     *
     * @return
     */
    @GetMapping("/sendHTMLMail")
    public String sendHTMLMail() {
        mailService.sendHTMLMail();
        return "success";
    }

    /**
     * 发送嵌入静态资源的邮件
     *
     * @return
     */
    @GetMapping("/sendInlineResourceMail")
    public String sendInlineResourceMail() {
        mailService.sendInlineResourceMail();
        return "success";
    }

    /**
     * 发送带有附件的邮件
     *
     * @return
     */
    @GetMapping("/sendAttachmentsMail")
    public String sendAttachmentsMail() {
        mailService.sendAttachmentsMail();
        ;
        return "success";
    }

    /**
     * 发送freemarker模板邮件
     *
     * @return
     */
    @GetMapping("/sendTemplateFreemarker")
    public String sendTemplateFreemarker() {
        mailService.sendTemplateFreemarker();
        return "success";
    }

    /**
     * 发送Thymeleaf模板邮件
     *
     * @return
     */
    @GetMapping("/sendTemplateThymeleaf")
    public String sendTemplateThymeleaf() {
        mailService.sendTemplateThymeleaf();
        return "success";
    }

    /**
     * 发送邮件，附件为后端生成的excel
     *
     * @return
     */
    @GetMapping("/sendExcelMail")
    public String sendExcelMail() {
        mailService.sendExcelMail();
        return "success";
    }

    /**
     * 发送多附件的邮件
     *
     * @return
     */
    @GetMapping("/sendMultiAttachmentMail")
    public String sendMultiAttachmentMail() {
        mailService.sendMultiAttachmentMail();
        return "success";
    }

}
